package money;

import java.math.BigDecimal;
import java.math.RoundingMode;

/**
 * 四舍五入
 *
 * @author guodd
 * @version 1.0 use jdk 1.8
 */
public class RoundUse {
    static double a = 111231.5555;

    public static void main(String[] args) {
        m1();
    }

    public static void m1() {
        System.out.println(Double.valueOf(String.format("%.3f", a)));
        System.out.println(new BigDecimal(a).setScale(2, RoundingMode.HALF_UP));
    }
}
